import java.util.Arrays;

/**
 * @author LKQ
 * @date 2022/2/22 15:55
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        solution.hIndex(new int[]{3, 0, 6,1,5});
    }
    public int hIndex(int[] citations) {
        Arrays.sort(citations);
        int h = 0, i = citations.length - 1;
        while (i >= 0 && citations[i] > h) {
            h++;
            i--;
        }
        return h;
    }
}
